<?PHP
/**
* @desc Helllllloooo woorld!
*/
class indexController extends Controller {
	/** 
	* @desc A Demonstrationable Hello world action ;)
	* @actionConfig(layout="layouts/app")
	*/
	public function index() {
		$this->set("world","Wor1d");
		return $this->render();
	}
	
	/** 
	* @desc A Demonstrationable Hello world action + browser cache
	* @actionConfig(layout="layouts/app",view="index.index",browserCache=true,browserCacheSecs=3600)
	*/
	public function cached() {
		$this->set("world","Wor1d");
		return $this->render();
	}
	
	/** 
	* @desc A Demonstrationable fillForms attribute
	* @actionConfig(layout="layouts/app",fillForms=true)
	*/
	public function forms() {
		return $this->render();
	}
	
	public function hmvc() {
		return ($this->get("showMessage") === true ? "yeah hmvc is working!" : "");
	}
	/**
	* @desc Testing of exportable (json)
	* @actionConfig(exportType="json",exportVars={'hello','world'})
	*/
	public function exportable($world="No world defined ;)") {
		$this->set("hello","w0rld");
		$this->set("world",$world);
		return $this->render();
	}
	/** 
	* @desc Benchmark
	* @actionConfig(layout="layouts/app")
	*/
	public function bench() {
		$this->set("count",$count=1000);
		
		profile("index");
		for($i=0;$i<$count;$i++) {
			o("index.index")->exec();
		}
		$this->set("index",profile("index"));
		
		profile("forms");
		for($i=0;$i<$count;$i++) {
			o("index.forms")->exec();
		}
		$this->set("forms",profile("forms"));
		
		profile("cached");
		for($i=0;$i<$count;$i++) {
			o("index.cached")->exec();
		}
		$this->set("cached",profile("cached"));
		
		profile("phpInternal1");
		for($i=0;$i<$count;$i++) {
			$a = eregi(rand(1,10000),rand(1,99999));
		}
		$this->set("phpInternal1",profile("phpInternal1"));
		
		return $this->render();
	}
}
?>